import { defineStore } from 'pinia';

interface ObjectList {
    [key: string]: string[];
}

export const usePermissStore = defineStore('permiss', {
    state: () => {
        const defaultList: ObjectList = {
            admin: [
              '0', '100','101','102','102_1','102_2','102_4','103','104','104_1','104_2','105','105_1','105_2','105_3','105_4','100_1','105_5'
            ],
            user: ['0', '100','101','102','102_1','102_2','102_4','102_6','103','104','104_1','104_2','105','105_1','105_2','105_3','105_4','100_1','105_5','105_6','105_7','105_8','102_5','106','106_1','106_2','107'],
        };
        const username = localStorage.getItem('vuems_name');
        console.log(username,'用户名'); 
        return {
            key: (username == 'admin921380356' ? defaultList.admin : defaultList.user) as string[],
            defaultList,
        };
    },
    actions: {
        handleSet(val: string[]) {
            this.key = val;
        },
    },
});
